using SheLife.Domain.Entities;

namespace SheLife.Application.Interfaces
{
    /// <summary>
    /// 社区帖子服务接口
    /// </summary>
    public interface ICommunityPostService
    {
        Task<CommunityPost?> GetCommunityPostByIdAsync(Guid id);
        Task<IEnumerable<CommunityPost>> GetAllCommunityPostsAsync(int page = 1, int pageSize = 20);
        Task<IEnumerable<CommunityPost>> GetCommunityPostsByUserIdAsync(Guid userId, int page = 1, int pageSize = 20);
        Task<IEnumerable<CommunityPost>> GetCommunityPostsByCategoryIdAsync(Guid categoryId, int page = 1, int pageSize = 20);
        Task<IEnumerable<CommunityPost>> GetCommunityPostsByTagAsync(string tag, int page = 1, int pageSize = 20);
        Task<IEnumerable<CommunityPost>> GetHotCommunityPostsAsync(int page = 1, int pageSize = 20);
        Task<IEnumerable<CommunityPost>> GetRecommendedCommunityPostsAsync(Guid userId, int page = 1, int pageSize = 20);
        Task<CommunityPost> CreateCommunityPostAsync(Guid userId, Guid categoryId, string title, string content, string? imageUrl = null, List<string>? tags = null);
        Task<CommunityPost?> UpdateCommunityPostAsync(Guid id, string? title, string? content, string? imageUrl, List<string>? tags);
        Task<bool> DeleteCommunityPostAsync(Guid id);
        Task<CommunityPost?> LikeCommunityPostAsync(Guid id, Guid userId);
        Task<CommunityPost?> UnlikeCommunityPostAsync(Guid id, Guid userId);
        Task<CommunityPost?> ViewCommunityPostAsync(Guid id, Guid userId);
        Task<CommunityPost?> PinCommunityPostAsync(Guid id);
        Task<CommunityPost?> UnpinCommunityPostAsync(Guid id);
        Task<CommunityPost?> SetCommunityPostStatusAsync(Guid id, string status);
    }

    /// <summary>
    /// 社区帖子评论服务接口
    /// </summary>
    public interface ICommunityPostCommentService
    {
        Task<CommunityPostComment?> GetCommunityPostCommentByIdAsync(Guid id);
        Task<IEnumerable<CommunityPostComment>> GetCommunityPostCommentsByPostIdAsync(Guid postId, int page = 1, int pageSize = 20);
        Task<IEnumerable<CommunityPostComment>> GetCommunityPostCommentsByUserIdAsync(Guid userId, int page = 1, int pageSize = 20);
        Task<IEnumerable<CommunityPostComment>> GetCommunityPostCommentsByParentIdAsync(Guid parentId, int page = 1, int pageSize = 20);
        Task<CommunityPostComment> CreateCommunityPostCommentAsync(Guid postId, Guid userId, string content, Guid? parentId = null);
        Task<CommunityPostComment?> UpdateCommunityPostCommentAsync(Guid id, string content);
        Task<bool> DeleteCommunityPostCommentAsync(Guid id);
        Task<CommunityPostComment?> LikeCommunityPostCommentAsync(Guid id, Guid userId);
        Task<CommunityPostComment?> UnlikeCommunityPostCommentAsync(Guid id, Guid userId);
    }

    /// <summary>
    /// 社区帖子点赞服务接口
    /// </summary>
    public interface ICommunityPostLikeService
    {
        Task<CommunityPostLike?> GetCommunityPostLikeByIdAsync(Guid id);
        Task<IEnumerable<CommunityPostLike>> GetCommunityPostLikesByPostIdAsync(Guid postId, int page = 1, int pageSize = 20);
        Task<IEnumerable<CommunityPostLike>> GetCommunityPostLikesByUserIdAsync(Guid userId, int page = 1, int pageSize = 20);
        Task<CommunityPostLike> CreateCommunityPostLikeAsync(Guid postId, Guid userId);
        Task<bool> DeleteCommunityPostLikeAsync(Guid id);
        Task<bool> IsUserLikedPostAsync(Guid postId, Guid userId);
    }

    /// <summary>
    /// 社区帖子收藏服务接口
    /// </summary>
    public interface ICommunityPostFavoriteService
    {
        Task<CommunityPostFavorite?> GetCommunityPostFavoriteByIdAsync(Guid id);
        Task<IEnumerable<CommunityPostFavorite>> GetCommunityPostFavoritesByUserIdAsync(Guid userId, int page = 1, int pageSize = 20);
        Task<IEnumerable<CommunityPostFavorite>> GetCommunityPostFavoritesByPostIdAsync(Guid postId, int page = 1, int pageSize = 20);
        Task<CommunityPostFavorite> CreateCommunityPostFavoriteAsync(Guid postId, Guid userId, string? notes = null);
        Task<CommunityPostFavorite?> UpdateCommunityPostFavoriteAsync(Guid id, string? notes);
        Task<bool> DeleteCommunityPostFavoriteAsync(Guid id);
        Task<bool> IsUserFavoritedPostAsync(Guid postId, Guid userId);
    }

    /// <summary>
    /// 社区帖子分类服务接口
    /// </summary>
    public interface ICommunityPostCategoryService
    {
        Task<CommunityPostCategory?> GetCommunityPostCategoryByIdAsync(Guid id);
        Task<IEnumerable<CommunityPostCategory>> GetAllCommunityPostCategoriesAsync();
        Task<CommunityPostCategory> CreateCommunityPostCategoryAsync(string name, string description, string? icon = null, int order = 0);
        Task<CommunityPostCategory?> UpdateCommunityPostCategoryAsync(Guid id, string? name, string? description, string? icon, int? order);
        Task<bool> DeleteCommunityPostCategoryAsync(Guid id);
    }

    /// <summary>
    /// 社区帖子标签服务接口
    /// </summary>
    public interface ICommunityPostTagService
    {
        Task<CommunityPostTag?> GetCommunityPostTagByIdAsync(Guid id);
        Task<IEnumerable<CommunityPostTag>> GetAllCommunityPostTagsAsync();
        Task<IEnumerable<CommunityPostTag>> GetPopularCommunityPostTagsAsync(int count = 20);
        Task<CommunityPostTag> CreateCommunityPostTagAsync(string name, string? description = null, string? color = null);
        Task<CommunityPostTag?> UpdateCommunityPostTagAsync(Guid id, string? name, string? description, string? color);
        Task<bool> DeleteCommunityPostTagAsync(Guid id);
    }

    /// <summary>
    /// 社区帖子报告服务接口
    /// </summary>
    public interface ICommunityPostReportService
    {
        Task<CommunityPostReport?> GetCommunityPostReportByIdAsync(Guid id);
        Task<IEnumerable<CommunityPostReport>> GetCommunityPostReportsByPostIdAsync(Guid postId);
        Task<IEnumerable<CommunityPostReport>> GetCommunityPostReportsByUserIdAsync(Guid userId);
        Task<IEnumerable<CommunityPostReport>> GetCommunityPostReportsByStatusAsync(string status);
        Task<CommunityPostReport> CreateCommunityPostReportAsync(Guid postId, Guid userId, string reason, string? description = null);
        Task<CommunityPostReport?> UpdateCommunityPostReportAsync(Guid id, string? status, string? description);
        Task<bool> DeleteCommunityPostReportAsync(Guid id);
        Task<CommunityPostReport?> HandleCommunityPostReportAsync(Guid id, string status, string? handlingNotes = null);
    }

    /// <summary>
    /// 社区帖子浏览记录服务接口
    /// </summary>
    public interface ICommunityPostViewService
    {
        Task<CommunityPostView?> GetCommunityPostViewByIdAsync(Guid id);
        Task<IEnumerable<CommunityPostView>> GetCommunityPostViewsByPostIdAsync(Guid postId, int page = 1, int pageSize = 20);
        Task<IEnumerable<CommunityPostView>> GetCommunityPostViewsByUserIdAsync(Guid userId, int page = 1, int pageSize = 20);
        Task<CommunityPostView> CreateCommunityPostViewAsync(Guid postId, Guid userId);
        Task<bool> DeleteCommunityPostViewAsync(Guid id);
        Task<Dictionary<string, object>> GetPostViewStatisticsAsync(Guid postId);
    }

    /// <summary>
    /// 社区帖子分享服务接口
    /// </summary>
    public interface ICommunityPostShareService
    {
        Task<CommunityPostShare?> GetCommunityPostShareByIdAsync(Guid id);
        Task<IEnumerable<CommunityPostShare>> GetCommunityPostSharesByPostIdAsync(Guid postId);
        Task<IEnumerable<CommunityPostShare>> GetCommunityPostSharesByUserIdAsync(Guid userId);
        Task<CommunityPostShare> CreateCommunityPostShareAsync(Guid postId, Guid userId, string platform);
        Task<bool> DeleteCommunityPostShareAsync(Guid id);
        Task<Dictionary<string, object>> GetPostShareStatisticsAsync(Guid postId);
    }

    /// <summary>
    /// 社区用户关注服务接口
    /// </summary>
    public interface ICommunityUserFollowService
    {
        Task<CommunityUserFollow?> GetCommunityUserFollowByIdAsync(Guid id);
        Task<IEnumerable<CommunityUserFollow>> GetCommunityUserFollowsByUserIdAsync(Guid userId);
        Task<IEnumerable<CommunityUserFollow>> GetCommunityUserFollowsByFollowedUserIdAsync(Guid followedUserId);
        Task<CommunityUserFollow> CreateCommunityUserFollowAsync(Guid userId, Guid followedUserId);
        Task<bool> DeleteCommunityUserFollowAsync(Guid id);
        Task<bool> IsUserFollowingUserAsync(Guid userId, Guid followedUserId);
    }

    /// <summary>
    /// 社区用户黑名单服务接口
    /// </summary>
    public interface ICommunityUserBlockService
    {
        Task<CommunityUserBlock?> GetCommunityUserBlockByIdAsync(Guid id);
        Task<IEnumerable<CommunityUserBlock>> GetCommunityUserBlocksByUserIdAsync(Guid userId);
        Task<IEnumerable<CommunityUserBlock>> GetCommunityUserBlocksByBlockedUserIdAsync(Guid blockedUserId);
        Task<CommunityUserBlock> CreateCommunityUserBlockAsync(Guid userId, Guid blockedUserId, string? reason = null);
        Task<bool> DeleteCommunityUserBlockAsync(Guid id);
        Task<bool> IsUserBlockingUserAsync(Guid userId, Guid blockedUserId);
    }

    /// <summary>
    /// 社区统计服务接口
    /// </summary>
    public interface ICommunityStatisticsService
    {
        Task<Dictionary<string, object>> GetCommunityStatisticsAsync();
        Task<Dictionary<string, object>> GetPostStatisticsAsync(int days = 30);
        Task<Dictionary<string, object>> GetUserStatisticsAsync(int days = 30);
        Task<Dictionary<string, object>> GetCategoryStatisticsAsync();
        Task<Dictionary<string, object>> GetTagStatisticsAsync();
    }
}